package com.linsir.lin.service;

import com.linsir.lin.dto.GridDTO;
import com.linsir.lin.dto.OrganizationDTO;
import com.linsir.lin.pojo.Organization;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * @ProjectName:linsir-lin
 * @Package:com.linsir.lin.service
 * @Title: OrganizationService
 * @Description: 组织
 * @Create:2021/6/28 23:04 by @author:Linsir
 * @Update:2021/6/28 23:04 by @author:Linsir
 * @UpdateRemark: 初始创建
 * @Version: 1.0.0
 */
public interface OrganizationService {

    /**
     * 安装树形结构展示
     * @return
     */
    GridDTO<Organization> grid();

    /**
     * 树形组织
     * @return
     */
    List<OrganizationDTO> organList();

    /**
     * 转化
     * @param organization
     * @return
     */
    OrganizationDTO toDTO(Organization organization) throws InvocationTargetException, IllegalAccessException;

    /**
     *
     * @param treeList
     * @param pid
     * @return
     */
    List<OrganizationDTO> toTree(List<OrganizationDTO> treeList, Integer pid);


    /**
     *
     * @param parent
     * @param treeList
     * @return
     */
    OrganizationDTO findChildren(OrganizationDTO parent, List<OrganizationDTO> treeList);

    /**
     * 根据ids 获取组织id列表
     * @param ids
     * @return
     */
    List<Organization> getOrganizationsByIds(List<Integer> ids);

    /**
     * 遍历树相关操作
     * @param list
     * @param list
     */
    List<OrganizationDTO> getChildren(List<OrganizationDTO> list);

    /**
     * 遍历树相关操作
     * @param organizationDTO
     * @return
     */
    List<OrganizationDTO> getTree(OrganizationDTO organizationDTO);

    OrganizationDTO getByOrganId(Integer organId) throws InvocationTargetException, IllegalAccessException;

    /**
     * 根据ID获取组织
     * @param id
     * @return
     */
    Organization getById(Integer id);
}
